package com.dinzeer.resonantisshelomoh.data;

import com.dinzeer.resonantisshelomoh.regsiter.RSitemRegsitry;
import mods.flammpfeil.slashblade.init.SBItems;
import mods.flammpfeil.slashblade.recipe.RequestDefinition;
import mods.flammpfeil.slashblade.recipe.SlashBladeIngredient;
import mods.flammpfeil.slashblade.recipe.SlashBladeShapedRecipeBuilder;
import net.minecraft.data.PackOutput;
import net.minecraft.data.recipes.FinishedRecipe;
import net.minecraft.data.recipes.RecipeProvider;
import net.minecraft.world.item.Items;
import net.minecraftforge.common.crafting.conditions.IConditionBuilder;

import java.util.function.Consumer;

public class RSRecipeProvoider extends RecipeProvider implements IConditionBuilder {
    //合成表datagen
    public RSRecipeProvoider(PackOutput output) {
        super(output);
    }
    protected void buildRecipes(Consumer<FinishedRecipe> consumer){
        SlashBladeShapedRecipeBuilder.shaped(RSBuiltInRegsitry.Reversed.location())
                .pattern("ABC")
                .pattern("DEF")
                .pattern("GHG")
                .define('A', Items.SPIDER_EYE)
                .define('B', Items.REDSTONE_BLOCK)
                .define('C', Items.NETHER_STAR)
                .define('D', Items.POPPY)
                .define('E',SlashBladeIngredient.of(
                        RequestDefinition.Builder.newInstance()
                                .name(RSBuiltInRegsitry.reflection.location())
                                .killCount(3000)
                                .proudSoul(7300)
                                .refineCount(30)

                                .build()
                ))
                .define('F',Items.BONE)
                .define('G',Items.OBSIDIAN)
                .define('H',Items.GOLD_BLOCK)
                .unlockedBy(getHasName(SBItems.slashblade), has(SBItems.slashblade)).save(consumer);
        SlashBladeShapedRecipeBuilder.shaped(RSBuiltInRegsitry.temperance.location())
                .pattern("ABC")
                .pattern("DED")
                .pattern("FGH")
                .define('A', Items.BOOK)
                .define('B', Items.POPPY)
                .define('C', Items.IRON_BLOCK)
                .define('D', Items.STRING)
                .define('E', Items.IRON_BLOCK)
                .define('F', SBItems.slashblade)
                .define('G', Items.GOLD_BLOCK)
                .define('H', Items.SUNFLOWER)
                .unlockedBy(getHasName(SBItems.slashblade), has(SBItems.slashblade)).save(consumer);


        SlashBladeShapedRecipeBuilder.shaped(RSBuiltInRegsitry.reflection.location())
                .pattern("ABC")
                .pattern("DEF")
                .pattern("GHI")
                .define('A', Items.GOLD_BLOCK)
                .define('B', Items.GLASS)
                .define('C', Items.DIAMOND)
                .define('D', SBItems.proudsoul_trapezohedron)
                .define('E', Items.DIAMOND)
                .define('F', Items.LAPIS_BLOCK)
                .define('G',
                        SlashBladeIngredient.of(
                                RequestDefinition.Builder.newInstance()
                                        .name(RSBuiltInRegsitry.temperance.location())
                                        .killCount(1500)
                                        .proudSoul(30000)
                                        .refineCount(10)
                                        .build()
                        )
                )
                .define('H', SBItems.proudsoul_trapezohedron)
                .define('I', Items.POPPY)
                .unlockedBy(getHasName(SBItems.slashblade), has(SBItems.slashblade)).save(consumer);

        SlashBladeShapedRecipeBuilder.shaped(RSBuiltInRegsitry.reverse_solomon.location())
                .pattern("ABC")
                .pattern("DEF")
                .pattern("GHI")
                .define('A', Items.NETHERITE_BLOCK)
                .define('B', Items.DRAGON_EGG)
                .define('C', Items.NETHER_STAR)
                .define('D', RSitemRegsitry.RedRose.get())
                .define('E', Items.NETHER_STAR)
                .define('F', Items.QUARTZ_BLOCK)
                .define('G',
                        SlashBladeIngredient.of(
                                RequestDefinition.Builder.newInstance()
                                        .name(RSBuiltInRegsitry.Reversed.location())
                                        .killCount(3000)
                                        .proudSoul(60000)
                                        .refineCount(50)
                                        .build()
                        )
                )
                .define('H',  RSitemRegsitry.BlueRose.get())
                .define('I', Items.WITHER_ROSE)
                .unlockedBy(getHasName(SBItems.slashblade), has(SBItems.slashblade)).save(consumer);
        SlashBladeShapedRecipeBuilder.shaped(RSBuiltInRegsitry.solomon.location())
                .pattern("   ")
                .pattern(" A ")
                .pattern("   ")
                .define('A',
                        SlashBladeIngredient.of(
                                RequestDefinition.Builder.newInstance()
                                        .name(RSBuiltInRegsitry.reverse_solomon.location())
                                        .build()
                        )
                )

                .unlockedBy(getHasName(SBItems.slashblade), has(SBItems.slashblade)).save(consumer);


        SlashBladeShapedRecipeBuilder.shaped(RSitemRegsitry.BlueRose.get())
                .pattern("ABA")
                .pattern("CDC")
                .pattern("ACA")
                .define('A',
                       Items.NETHERITE_BLOCK)
                .define('B', Items.HEART_OF_THE_SEA)
                .define('C', Items.NETHER_STAR)
                .define('D', Items.POPPY)
                .unlockedBy(getHasName(SBItems.slashblade), has(SBItems.slashblade)).save(consumer);
        SlashBladeShapedRecipeBuilder.shaped(RSitemRegsitry.RedRose.get())
                .pattern("ABA")
                .pattern("CDC")
                .pattern("ACA")
                .define('A',
                        Items.NETHERITE_BLOCK)
                .define('B', Items.ECHO_SHARD)
                .define('C', Items.NETHER_STAR)
                .define('D', Items.WITHER_ROSE)
                .unlockedBy(getHasName(SBItems.slashblade), has(SBItems.slashblade)).save(consumer);





    }
}
